<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>成都博物馆内容管理平台</title>
    <link rel="stylesheet" href="../css/ext/bootstrap.min.css">
    <link rel="stylesheet" href="../css/common/base.css">
    <link rel="stylesheet" href="../css/recommend/recommend.css">
    <script src="../js/ext/jquery-1.11.3.js"></script>
    <script src="../js/ext/bootstrap.min.js"></script>
    <script src="../js/ext/uploadPreview.js"></script>
    <script src="../js/base.js"></script>
</head>
<body>
<% include ../common/header.jsp %>
<div class="main">
    <% include ../common/menu.jsp %>
    <div class="main-content">
        <div class="wrapper">
            <div class="content-title">
                <!--面包屑-->
                <ol class="breadcrumb">
                    <li>首页管理</li>
                    <li class="active">常设展览</li>
                </ol>
            </div><!--content-title-->
            <p>常设展览（No.4）</p>
            <form action="uploadfiles" method="post" enctype="multipart/form-data">
                <div class="form-list">
                    <label class="l80"><i class="ic ic-dotred"></i>名称</label>
                    <input id="name" class="i280" type="text" name="name" maxlength="30">
                    <em>不超过30个字符，可由中英文数字及中英文符号组成</em>
                </div>
                <div class="form-list">
                    <label class="l80"><i class="ic ic-dotred"></i>图片</label>
                    <div class="img-ext">
                        <div id="imgdiv" class="image-preview">
                            <img style="width: 400px;height: 242px" id="imgShow" src="">
                        </div>
                        <div class="filebtn">
                            <a class="btn btn-upimg" href="javascript:"><span>上传图片</span></a>
                            <em>图片大小为540*320</em>
                            <input type="file" id="up_img" name="file_name">
                        </div>
                    </div>
                </div>
                <div class="form-list">
                    <label class="l80"><i class="ic ic-dotred"></i>跳转参数</label>
                    <select id="sel-type" class="i280" name="jump" style="width: 120px;">
                        <option value="1" selected>栏目内容</option>
                        <option value="2">静态内容</option>
                    </select>
                    <input id="tzcs" class="i280" type="text" name="jump_content" value="" style="width: 469px;">
                    <em></em>
                </div>
                <div class="form-list textarea">
                    <label class="l80 pl16">备注</label>
                    <textarea id="remark" class="t594" name="info"></textarea>
                    <em>不超过200个字符</em>
                </div>
                <div style="margin-left: 88px">
                    <input class="btn btn-submit" type="submit" value="提交">
                    <a class="btn btn-cancel" style="margin-left: 40px"><span>取消</span></a>
                </div>
            </form>
        </div><!--wrapper-->
        <div class="preview">
            <img class="img-responsive" src="../images/base/client-index.png" alt="">
        </div>
    </div><!--main-content-->
</div>
<script>
    $(function () {
        new uploadPreview({UpBtn: "up_img", DivShow: "imgdiv", ImgShow: "imgShow"});
        $('.btn-upimg').click(function () {
            $('#up_img').trigger('click');
        });
        /**跳转参数验证*/
        function check_tzcs() {
            var tar = $('#tzcs');
            var val = tar.val();
            if ($.trim(val) == '') {
                tar.parent().find('em').html('<i class="ic ic-warn"></i>跳转参数不能为空').show();
                return false
            } else {
                tar.parent().find('em').html('<i class="ic ic-right">').show();
                return true
            }
        }

        $('#name').blur(function () {
            check_name();
        });
        $('#tzcs').blur(function () {
            check_tzcs();
        });
        /*提交时验证*/
        $(document).submit(function () {
            var mark = 0;
            if (check_name())mark++;
            if (check_img())mark++;
            if (check_tzcs())mark++;
            if (check_remark())mark++;
            if (mark == 4) {
                $('.btn-submit').val('提交中...').attr('disabled', true);
                setTimeout("$('.btn-submit').val('提交').attr('disabled',false)", 300);
                return false;
            } else {
                return false;
            }
        })
    })
</script>
</body>
</html>